#include "..\deleaker\mem2.h"
#include "disp.h"

#include "..\\include\cfg_items.h"
#include "conf_loader.h"
#include "config_data.h"

char* CMyDisp::getName()
{
  return "Standby_WidgetDisp";
}

void CMyDisp::onKey(int key, int unk, int repeat, int type)
{
  
}

void CMyDisp::onDestroy()
{
  
}

int CMyDisp::onCreate()
{
  isondraw = false;
  SetRefreshTimer(1000);
  return 1;
}

void CMyDisp::onDraw(int a,int b,int c)
{
  isondraw = true;
  BATT bat;
  wchar_t temp[128];
  GetBatteryState(NULL , &bat);
  snwprintf(temp,128,L"%d mA\nAvailable capacity %d mAh",(bat.ChargerCurrent-bat.CurrentToBattery)/10,bat.RemainingCapacity);
  STRID batid=Str2ID(temp,0,SID_ANY_LEN);
  DrawString( batid, 0, 10, 60, 176, 220, 20, 0, clYellow, clBlack );
  TextFree(batid);
  isondraw = false;
}

void CMyDisp::onRefresh()
{
  if(IsVisible())
  {
    if(!isondraw)
    InvalidateRect(NULL);
  }
  SetRefreshTimer(1000);
}

void CMyDisp::onLayout()
{
  this->SetLayerColor(0);
}

